<?php
class Admin_Form_Students extends Zend_Form{
	
	function __construct($options=null){
		parent::__construct($options);
		
		$sub_id = new Zend_Form_Element_Hidden('student_id');
		$sub_id -> setAttrib('class', 'form_els');
		
		$f_name = new Zend_Form_Element_Text('first_name');
		$f_name->setRequired(TRUE)
			->setLabel('Название предмета')
			->addFilter('StripTags')
			->addFilter('StringTrim')
			->addValidator('NotEmpty')
			->setAttrib('class', 'form_els')
			->setDecorators(array(
				'ViewHelper',
				'Errors',
				'Label',
				array(array('data' => 'HtmlTag'), array('tag' => 'td')),
			))
			->addDecorator('Label',array(array('data' => 'HtmlTag'), array('tag' => 'td')));
		
		$l_name = new Zend_Form_Element_Text('last_name');
		$l_name->setRequired(TRUE)
			->setLabel('Название предмета')
			->addFilter('StripTags')
			->addFilter('StringTrim')
			->addValidator('NotEmpty')
			->setAttrib('class', 'form_els')
			->setDecorators(array(
				'ViewHelper',
				'Errors',
				'Label',
				array(array('data' => 'HtmlTag'), array('tag' => 'td')),
				))
			->addDecorator('Label',array(array('data' => 'HtmlTag'), array('tag' => 'td')));
		
		$phone = new Zend_Form_Element_Text('phone');
		$phone->setRequired(TRUE)
			->setLabel('Название предмета')
			->addFilter(new Zend_Filter_Int())
			->addValidator('NotEmpty')
			->setAttrib('class', 'form_els')
			->setDecorators(array(
				'ViewHelper',
				'Errors',
				'Label',
				array(array('data' => 'HtmlTag'), array('tag' => 'td')),
				))
			->addDecorator('Label',array(array('data' => 'HtmlTag'), array('tag' => 'td')));
		
		$gr = new Zend_Form_Element_Select('group_id');
		$gr->setAttrib('class', 'form_els')
			->addMultiOptions(Admin_Model_Students::getGroupList())
			->setLabel('группа');
		
		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setAttrib('id', 'submitbutton')
			->setLabel('Сохранить')
			->setDecorators(array(
				'ViewHelper',
				'Errors',
				array(array('data' => 'HtmlTag'), array('tag' => 'td')),
			));
		
		$this->addElements(array($sub_id, $f_name,$l_name,$phone,$gr, $submit))
			->setAttrib('id', 'popup_form')
			->setMethod('post')
			->setView(new Zend_View)
			->clearDecorators()
			->setDecorators(array(
				'FormElements',
				array('HtmlTag', array('tag' => 'table', 'class'=>'login_form')),
				array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
				'Form',
			));
	}
}